﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Cinema
{
    /// <summary>
    /// Interaction logic for Desk.xaml
    /// </summary>
    public partial class Desk : Page
    {
        public static DependencyProperty ContentFrameSourceProperty = DependencyProperty.Register("pagContentFrameSource", typeof(Page), typeof(Desk));
        public Page pagContentFrameSource
        {
            get { return (Page)GetValue(ContentFrameSourceProperty); }
            set { SetValue(ContentFrameSourceProperty, value); }
        }
        public StackPanel MainMenu { get; set; }
        public Desk()
        {
            InitializeComponent();
            MainMenu = FindResource("MainMenu") as StackPanel;
        }
        public static Bussiness.Cinema.DeskType dataContext = new Bussiness.Cinema.DeskType();
      

        static _Desk.Diagram pagDiagram = new _Desk.Diagram();
        static _Desk.Type pagType = new _Desk.Type();
        Button btnPreTab;
        void TabHandle(object sender, RoutedEventArgs e)
        {
            var btnSender = sender as Button;
            switch (btnSender.Uid)
            {
                case "Diagram":
                    pagContentFrameSource = pagDiagram;
                    break;
                case "Type":
                    pagContentFrameSource = pagType;
                    break;
            }
            if (btnPreTab != null) btnPreTab.IsEnabled = true;
            btnPreTab = btnSender;
            btnSender.IsEnabled = false;
        }

        private void TabHandle(object sender, EventArgs e)
        {
            TabHandle(sender, new RoutedEventArgs());
        }

        private void Expander_Initialized(object sender, EventArgs e)
        {
            (sender as Expander).DataContext = pagType.DataContext;
        }

    }
}
